package com.pangu;

import com.pangu.bean.DeviceConfig;

/**
 * Mob模块的Bean对象管理器
 * <p/>
 * Created by cuijianhui_91
 */
public abstract class MobBeanManager extends ABeanManager {

    protected AMApplication imContext;

    public MobBeanManager(AMApplication imContext) {
        this.imContext = imContext;
    }

    @Override
    protected <T> T createBean(Class<T> clazz, String mark) {
        Object obj = null;
        if (clazz == DeviceConfig.class) {
            obj = new DeviceConfig();

        } else if (clazz == ModuleManager.class) {
            obj = new ModuleManager(imContext);

        } else if (clazz == PreConfigManager.class) {
            obj = new PreConfigManager(imContext);

        }

        return (T) obj;
    }

    /**
     * 获取环境配置
     *
     * @return
     */
    public DeviceConfig getDeviceConfig() {
        return getBean(DeviceConfig.class);
    }

    /**
     * 获取模块管理器
     *
     * @return
     */
    public ModuleManager getModuleManager() {
        return getBean(ModuleManager.class);
    }

    /**
     * 获取运行时管理器
     *
     * @return
     */
    public PreConfigManager getPreConfigManager() {
        return getBean(PreConfigManager.class);
    }
}
